Overview | Package | Class | Tree | Deprecated | Index | Help |
Java Platform 1.1.7 |
||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The JTable can be set up to display any data model which implements the TableModel interface with a couple of lines of code:
TableModel myData = new MyTableModel();
JTable table = new JTable(myData);
Method Summary | |
void | addTableModelListener(TableModelListener l)
Add a listener to the list that's notified each time a change to the data model occurs. |
java.lang.Class | getColumnClass(int columnIndex)
Returns the lowest common denominator Class in the column. |
int | getColumnCount()
Returns the number of columns managed by the data source object. |
java.lang.String | getColumnName(int columnIndex)
Returns the name of the column at columnIndex. |
int | getRowCount()
Returns the number of records managed by the data source object. |
java.lang.Object | getValueAt(int rowIndex,
int columnIndex)
Returns an attribute value for the cell at columnIndex and rowIndex. |
boolean | isCellEditable(int rowIndex,
int columnIndex)
Returns true if the cell at rowIndex and columnIndex is editable. |
void | removeTableModelListener(TableModelListener l)
Remove a listener from the list that's notified each time a change to the data model occurs. |
void | setValueAt(java.lang.Object aValue,
int rowIndex,
int columnIndex)
Sets an attribute value for the record in the cell at columnIndex and rowIndex. |
Method Detail |
public int getRowCount()
public int getColumnCount()
public java.lang.String getColumnName(int columnIndex)
columnIndex
- the index of columnpublic java.lang.Class getColumnClass(int columnIndex)
public boolean isCellEditable(int rowIndex, int columnIndex)
rowIndex
- the row whose value is to be looked up
columnIndex
- the column whose value is to be looked uppublic java.lang.Object getValueAt(int rowIndex, int columnIndex)
rowIndex
- the row whose value is to be looked up
columnIndex
- the column whose value is to be looked uppublic void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
aValue
- the new value
rowIndex
- the row whose value is to be changed
columnIndex
- the column whose value is to be changedpublic void addTableModelListener(TableModelListener l)
l
- the TableModelListenerpublic void removeTableModelListener(TableModelListener l)
l
- the TableModelListenerOverview | Package | Class | Tree | Deprecated | Index | Help |
Java Platform 1.1.7 |
||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |